package com.zts.base.page;

import org.apache.ibatis.session.RowBounds;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Created by Zhangkh on 2017/5/31.
 */
public class PageBound extends RowBounds {
    private boolean containsTotal = false;

    private boolean asyncTotal = false;

    private List<PageOrder> orders = new ArrayList<>();
    public  PageBound(){
        super();
    }

    public PageBound(PageOrder... orders) {
        super();
        Collections.addAll(this.orders, orders);
    }

    public PageBound(int offset, int limit, PageOrder... orders) {
        this(offset, limit, false, false, orders);
    }

    public PageBound(int offset, int limit, boolean containsTotal, PageOrder... orders) {
        this(offset, limit, containsTotal, false, orders);
    }

    public PageBound(int offset, int limit, boolean containsTotal, boolean asyncTotal, PageOrder... orders) {
        super(offset, limit);
        this.containsTotal = containsTotal;
        this.asyncTotal = asyncTotal;
        Collections.addAll(this.orders, orders);
    }

    public boolean isContainsTotal() {
        return containsTotal;
    }

    public void setContainsTotal(boolean containsTotal) {
        this.containsTotal = containsTotal;
    }

    public boolean isAsyncTotal() {
        return asyncTotal;
    }

    public void setAsyncTotal(boolean asyncTotal) {
        this.asyncTotal = asyncTotal;
    }

    public List<PageOrder> getOrders() {
        return orders;
    }

    public void setOrders(List<PageOrder> orders) {
        this.orders = orders;
    }
}

